/**
 @file random.h
 @brief Protypes and types that allow workloads to create and access random number generators.
*/

#ifndef WG_RANDOM_HEADER
#define WG_RANDOM_HEADER

/** Determines the length of any array that makes up a hashtable in the generator. */
#define HASHSIZE 10

#include <stdlib.h>
#include "cJSON.h"

/** Sets up all the data structures needed for using random number generators. */
void setup_random_environment(void);

/** Sets up an array of pthread_mutex_t structures */
void setup_mutex_array(pthread_mutex_t[HASHSIZE]);

/** Set up an random number generator identified by a string and described by cJSON.*/
int setup_rng(char *, cJSON *);

/** Get the next random number from a random number generator identified by a string */
double get_random_number(char *);

/** Use unsigned long integers as a hashed value */
typedef unsigned long int hashed;

/** Hash an integer into an index of a hash table. */
hashed int_hash(unsigned long int);

/** Hash a string into an index of a hash table. */
hashed hash(char *);

#endif
